﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] arr = new double[10];
            int studentsum = 0;
            float cjsum = 0;
            float cjavg = 0;

            try
            {
                for (int i = 0; i < arr.Length; i++)
                {
                    Console.WriteLine("请输入考生成绩");
                    float cj = float.Parse((Console.ReadLine()));
                    arr[i] = cj;
                    studentsum++;
                    cjsum = cjsum + cj;
                }
            }
            catch (FormatException f)
            {
                Console.WriteLine("异常已经处理");
                Console.WriteLine(f.Message);
                Console.WriteLine(f.Source);

            }
            catch (OverflowException)

            {
                Console.WriteLine("数值超出float范围");
                Console.WriteLine("异常已经处理");
            }
            catch (Exception e) {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.Source);
            }
            finally {
                cjavg = (cjsum / studentsum);
                Console.WriteLine("总学生数:{0}，总分数:{1}，平均分:{2}。",studentsum,cjsum,cjavg);
            }
        }
    }
}
